#ifndef NODE_H_
#define NODE_H_
#include<vector> 
using namespace std;
class Node{
public:
	Node():feature(-1),selectValue(0.0),label(-1),leaf(false){}
	virtual ~Node(){
		for(int i = 0;i<children.size();i++){
			if(children[i]!=NULL){delete children[i];}
		}
	}
	void addChild(Node * child){children.push_back(child);}
	vector<Node*>& getChildren(){return children;}
	void setLabel(double label){this->label=label;}
	double getLabel()const{return this->label;}
	void setSelectValue(double select){this->selectValue=select;}
	double getSelectValue()const{return this->selectValue;}
	void setFeature(int fea){this->feature=fea;}
	int getFeature(){return this->feature;}
	void addData(int dataIndex){datas.push_back(dataIndex);}
	vector<int>& getDatas(){return datas;}
	bool isLeaf(){return this->leaf;}
	void setLeaf(bool isleaf){this->leaf = isleaf;}
private:
	//结点类型，是否是叶子结点
	bool leaf;
	//当前节点的分类
	double label;
    //当前节点选择的feature
    int feature;
	//当前结点选择的feature所对应的value
	double selectValue;
	//当前结点对应的数据,cart树需要存储
	vector<int> datas;
	//子节点(ID3和C4.5使用)
	vector<Node*> children;
};
#endif
